Skip to content

Conversation

@jacobpake
Copy link
Member

@jacobpake jacobpake commented Apr 5, 2025

Previously we were allowing read/write to index = length e.g.

-- 100
main : Float
main =
    unpack<id, arr> = newFloatArray 0 in
    let arr' = writeFloatArray arr 0 100.0 in
    let (x, arr'') = readFloatArray arr' 0 in
    let () = deleteFloatArray arr'' in
    x

For immutable arrays this was caught by the Haskell IOArray after our checks.

This PR changes the bound check to fail on index >= length rather than index > length.

Copy link
Contributor

@BinderDavid BinderDavid left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good

@dorchard dorchard merged commit f1da16f into main Dec 18, 2025
1 check failed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants